package imnu.th.tongxin;

/**
 * @author: lys
 * @类名: Mother
 * @Title:
 * @date: 2020/7/22
 **/
public class Mother extends Thread {
    private Kitchen kitchen;

    public Mother() {
    }
    public Mother(Kitchen kitchen) {
        super("妈妈");
        //设置守护线程，孩子们吃饱后，妈妈停止做饭
        this.setDaemon(true);
        this.kitchen = kitchen;
    }

    //做饭
    public void cock(){
        try {
            //做饭操作
            this.kitchen.do_cock();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void run() {
        while (true){
            this.cock();
        }
    }

    public Kitchen getKitchen() {
        return kitchen;
    }

    public void setKitchen(Kitchen kitchen) {
        this.kitchen = kitchen;
    }
}
